package dk.simonvogensen.itodo.client.model;

import com.google.gwt.user.client.rpc.IsSerializable;

/**
 * @author $LastChangedBy: vogensen@gmail.com $
 * @version $Revision: 18 $
 */
public class Project implements IsSerializable {

    private ProjectId projectId;
    private int worktimeInMinutes;

    public Project(ProjectId projectId, int worktimeInMinutes) {
        this.projectId = projectId;
        this.worktimeInMinutes = worktimeInMinutes;
    }

    public Project() {
    }

    public int getWorktimeInMinutes() {
        return worktimeInMinutes;
    }

    public String getName() {
        return projectId.getName();
    }

    public ProjectId getProjectId() {
        return projectId;
    }

    public void substractTransportInWorktime(int transportTimeInMinutesPrProject) {
        worktimeInMinutes -= transportTimeInMinutesPrProject;
        worktimeInMinutes = worktimeInMinutes > 0 ? worktimeInMinutes : 0;
    }
}
